import request from "@/utils/request";
import type {AjaxResult,page} from "@/utils/request"

const base = '/base/user'


export const register = (data : any) => {
    return request({
        url: `${base}/register`,
        method: 'post',
        data:data
    })
}


export const getUserInfo = (userId? : string) : Promise<AjaxResult> => {
    return request({
        url: `${base}/getUserInfo`,
        method: 'get',
        params:{
            userId : userId
        }
    })
}

export const updateUserInfo = (data) => {
    return request({
        url: `${base}/updateUserInfo`,
        method: 'post',
        data:data
    })
}


export const getJudgeInfo = (userId? : string) : Promise<AjaxResult> => {
    return request({
        url: `${base}/getJudgeInfo`,
        method: 'get',
        params:{
            userId : userId
        }

    })
}

export const getHeatmap = (userId? : string) : Promise<AjaxResult> => {
    return request({
        url: `${base}/getHeatmap`,
        method: 'get',
        params:{
            userId : userId
        }
    })
}

export const getRecentlyACProblem = (userId? : string) : Promise<AjaxResult> => {
    return request({
        url: `${base}/getRecentlyACProblem`,
        method: 'get',
        params:{
            userId : userId
        }
    })
}

